package com.example.mybatis.moudle;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * bookkeeping
 * @author 
 */
@Data
public class Bookkeeping implements Serializable {
    /**
     * 主键 ,自动递增
     */
    private Integer id;

    /**
     * 金额
     */
    private Double count;

    /**
     * 时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8" )
    private Date date;

    /**
     * 种类:红包,人情往来...
     */
    private String kind;

    /**
     * 支付方式:微信,支付宝...
     */
    private String method;

    private String text;

    /**
     * 1入账,2支出
     */
    private Object flag;

    private static final long serialVersionUID = 1L;

    public Bookkeeping() {
    }

    public Bookkeeping(Integer id, Double count, Date date, String kind, String method, String text, Object flag) {
        this.id = id;
        this.count = count;
        this.date = date;
        this.kind = kind;
        this.method = method;
        this.text = text;
        this.flag = flag;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Bookkeeping other = (Bookkeeping) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount()))
            && (this.getDate() == null ? other.getDate() == null : this.getDate().equals(other.getDate()))
            && (this.getKind() == null ? other.getKind() == null : this.getKind().equals(other.getKind()))
            && (this.getMethod() == null ? other.getMethod() == null : this.getMethod().equals(other.getMethod()))
            && (this.getText() == null ? other.getText() == null : this.getText().equals(other.getText()))
            && (this.getFlag() == null ? other.getFlag() == null : this.getFlag().equals(other.getFlag()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode());
        result = prime * result + ((getDate() == null) ? 0 : getDate().hashCode());
        result = prime * result + ((getKind() == null) ? 0 : getKind().hashCode());
        result = prime * result + ((getMethod() == null) ? 0 : getMethod().hashCode());
        result = prime * result + ((getText() == null) ? 0 : getText().hashCode());
        result = prime * result + ((getFlag() == null) ? 0 : getFlag().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", count=").append(count);
        sb.append(", date=").append(date);
        sb.append(", kind=").append(kind);
        sb.append(", method=").append(method);
        sb.append(", text=").append(text);
        sb.append(", flag=").append(flag);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}